package main

import (
	"fmt"
	"unsafe"
)

/**
 * @Description
 * @Author huran
 * @Date
 * @Param
 * @return
 **/
func main() {
	//数组
	//var course = []string{"1"}
	//fmt.Printf("&=%T\n", course)
	////切片
	//var slice []string
	//fmt.Printf("&=%T\n", slice)
	//slice = append(slice, "go")
	//slice = append(slice, "gin")
	//slice = append(slice, "grpc")
	//fmt.Println(slice)
	////切片的初始化
	////数组
	//allCourse := [5]string{"go", "grpc", "gin", "mysql", "elasticsearch"}
	//fmt.Println(allCourse, len(allCourse))
	////左闭右开
	//strings := allCourse[0:len(allCourse)]
	//fmt.Println(strings, len(strings), cap(strings))
	////切片 第二种
	////allCourseSlice := []string{"go", "grpc", "gin", "mysql", "elasticsearch"}
	//
	//allCourseMake := make([]string, 3)
	//allCourseMake[0] = "232"
	//allCourseMake[1] = "232"
	//allCourseMake[2] = "232"
	//fmt.Println(allCourseMake)
	//
	//allCourse = [5]string{"go", "grpc", "gin", "mysql", "elasticsearch"}
	//var copyStr = make([]string, 3)
	//allCourse11 := allCourse[:3]
	//copy(copyStr, allCourse11)
	//fmt.Println(copyStr)
	allCourse := []string{"go", "grpc", "gin", "mysql", "elasticsearch"}
	printlnSlice(allCourse)
	fmt.Println(allCourse)
}

type Slice struct {
	array unsafe.Pointer
	len   int
	cap   int
}

func printlnSlice(course []string) {
	course[0] = "java"
	course[1] = "java1"
	for i := 0; i < 10; i++ {
		fmt.Printf("%p\n", course)
		course = append(course, "1")
	}
	fmt.Printf("========>>>%p\n", course)

}
